home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3c / sem_init.z / sem_init
Encoding:
Text File  |  1998-10-20  |  4.5 KB  |  132 lines

  1.  
  2.  
  3.  
  4. sssseeeemmmm____iiiinnnniiiitttt((((3333CCCC))))                                                      sssseeeemmmm____iiiinnnniiiitttt((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_eeee_mmmm______iiii_nnnn_iiii_tttt - initialize a posix unnamed semaphore
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_eeee_mmmm_aaaa_pppp_hhhh_oooo_rrrr_eeee_...._hhhh_>>>>
  13.      _iiii_nnnn_tttt _ssss_eeee_mmmm______iiii_nnnn_iiii_tttt_((((_ssss_eeee_mmmm______tttt _****_s_e_m_,,,, _iiii_nnnn_tttt _p_s_h_a_r_e_d_,,,, _uuuu_nnnn_ssss_iiii_gggg_nnnn_eeee_dddd _iiii_nnnn_tttt _v_a_l_u_e_))))_;;;;
  14.  
  15. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.      _ssss_eeee_mmmm______iiii_nnnn_iiii_tttt initializes the unnamed semaphore located at address _s_e_m.  The
  17.      address _s_e_m may reside anywhere in the calling processes address space,
  18.      but if the semaphore is intended to be shared across process boundaries,
  19.      _s_e_m must reside in shared memory.
  20.  
  21.      The _p_s_h_a_r_e_d argument is used to specify whether the semaphore is intended
  22.      to be shared across process boundaries or only used locally by threads of
  23.      execution within a common process.  If _p_s_h_a_r_e_d is set to zero, then the
  24.      semaphore _iiii_ssss _nnnn_oooo_tttt intended for sharing across process boundaries.
  25.      Conversely, a non-zero _p_s_h_a_r_e_d value indicates any process having read
  26.      and write access to address _s_e_m, may perform semaphore operations on _s_e_m.
  27.      Unnamed semaphores have been optimized for local thread usage, delivering
  28.      increased performance within posix thread applications [see
  29.      _pppp_tttt_hhhh_rrrr_eeee_aaaa_dddd______cccc_rrrr_eeee_aaaa_tttt_eeee(3P)].
  30.  
  31.      The initial value of the semaphore is specified by _v_a_l_u_e, which may be
  32.      any non-negative number less than {SEM_VALUE_MAX} [see _ssss_yyyy_ssss_cccc_oooo_nnnn_ffff(3C)].
  33.  
  34.      POSIX semaphores are compatible across all MIPS ABIs: o32, n32 and 64.
  35.  
  36.      Once a semaphore is initialized, processes may execute the following
  37.      semaphore operations: _ssss_eeee_mmmm______pppp_oooo_ssss_tttt, _ssss_eeee_mmmm______wwww_aaaa_iiii_tttt, _ssss_eeee_mmmm______tttt_rrrr_yyyy_wwww_aaaa_iiii_tttt, _ssss_eeee_mmmm______gggg_eeee_tttt_vvvv_aaaa_llll_uuuu_eeee,
  38.      _ssss_eeee_mmmm______dddd_eeee_ssss_tttt_rrrr_oooo_yyyy.
  39.  
  40.      _ssss_eeee_mmmm______iiii_nnnn_iiii_tttt will fail if one or more of the following are true:
  41.  
  42.      [EINVAL]    The _v_a_l_u_e parameter was set to a number greater than
  43.                  {SEM_VALUE_MAX}.
  44.  
  45.      [ENOSPC]    The resources required to initialize the semaphore have been
  46.                  depleted.
  47.  
  48.      [EPERM]     The calling process lacks the permissions required to
  49.                  initialize the semaphore.
  50.  
  51. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  52.      sem_destroy(3C), sem_getvalue(3C), sem_post(3C), sem_wait(3C),
  53.      sem_trywait(3C), sem_open(3C), sem_close(3C), sem_unlink(3C),
  54.      shm_open(3C), sysconf(3C), mmap(3C)
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                                                                         PPPPaaaaggggeeee 1111
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. sssseeeemmmm____iiiinnnniiiitttt((((3333CCCC))))                                                      sssseeeemmmm____iiiinnnniiiitttt((((3333CCCC))))
  69.  
  70.  
  71.  
  72. DIAGNOSTICS
  73.      Upon successful completion, a value of 0 is returned to the calling
  74.      process. Otherwise, a value of -1 is returned and _eeee_rrrr_rrrr_nnnn_oooo is set to
  75.      indicate the error.
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                                                         PPPPaaaaggggeeee 2222
  128.  
  129.  
  130.  
  131.